package com.wocharging.back.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wocharging.back.order.dto.OrderCashDetailDTO;
import com.wocharging.back.order.mapper.OrderCashDetailMapper;
import com.wocharging.back.order.service.OredrService;
import com.wocharging.base.domain.WoOrder;
import com.wocharging.base.mapper.WoOrderMapper;
import com.wocharging.base.service.IWoOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public  class OredrServiceImpl implements OredrService {

    @Autowired
    WoOrderMapper woOrderMapper;

    @Autowired
    OrderCashDetailMapper orderCashDetailMapper;

    @Autowired
    IWoOrderService woOrderService;

    /**
     *  todo 功能实现模块案例
     * @return
     */
    @Override
    public List<WoOrder> getOrderList() {
        List<OrderCashDetailDTO> list = orderCashDetailMapper.getList();
        Page<WoOrder> page = new Page<>(1,10);
        LambdaQueryWrapper<WoOrder> lqw = new LambdaQueryWrapper<>();
        lqw.eq(WoOrder::getId,1);
        Page<WoOrder> woOrders = woOrderMapper.selectPage(page,lqw);
        woOrderService.saveBatch(woOrders.getRecords());
        return woOrders.getRecords();
    }
}
